package vcp.client.forms;

import java.io.Serializable;
import java.util.ArrayList;

import vcp.enums.FormType;
import vcp.enums.SiteEnum;
import vcp.enums.SiteEnum.SiteCostsUpdateStatus;

/**
 * 
 * @author VCP team
 *         <p>
 *         Cost approval
 *         </p>
 */
public class ApproveCostForm extends FormAbstract
{
	/**
	 * 
	 */
	private static final long serialVersionUID = - 415667128374009613L;
	private final ArrayList <ApproveCostContainer> forms;

	/**
	 * 
	 * @return list of coast for approval
	 */
	public ArrayList <ApproveCostContainer> getFroms ()
	{
		return this.forms;
	}

	public ApproveCostForm ()
	{
		super(FormType.SITE_COSTS_APPROVE);
		this.forms = new ArrayList <>();
	}

	// ****************************************************************************************************************************
	// Public methods
	// ****************************************************************************************************************************
	/**
	 * add to form the coast according to site number
	 * 
	 * @param siteName
	 * @param updateStatus
	 */
	public void addForm ( SiteEnum siteName, SiteCostsUpdateStatus updateStatus )
	{
		this.forms.add(new ApproveCostContainer(siteName, updateStatus));
	}

	/**
	 * dose the form exists
	 * 
	 * @return true if yes false otherwise
	 */
	public boolean hasForms ()
	{
		return this.forms.size() > 0;
	}

	// ****************************************************************************************************************************
	// Public classes
	// ****************************************************************************************************************************
	/**
	 * Sub class that contain the approval forms
	 * 
	 * @author VCP team
	 * @see SiteCostsUpdateStatus
	 * @see SiteEnum
	 */
	public class ApproveCostContainer implements Serializable
	{
		/**
		 * 
		 */
		private static final long serialVersionUID = - 8695215992555449383L;
		/** update number **/
		private int updateID;

		public int getUpdateID ()
		{
			return this.updateID;
		}

		public void setUpdateID ( int updateID )
		{
			this.updateID = updateID;
		}

		/** site number **/
		private final SiteEnum siteName;

		public SiteEnum getSiteName ()
		{
			return this.siteName;
		}

		/** instance of status update **/
		private final SiteCostsUpdateStatus updateStatus;

		public SiteCostsUpdateStatus getUpdateStatus ()
		{
			return this.updateStatus;
		}

		/**
		 * send the approval info
		 * 
		 * @param siteName
		 * @param updateStatus
		 */
		private ApproveCostContainer ( SiteEnum siteName, SiteCostsUpdateStatus updateStatus )
		{
			this.siteName = siteName;
			this.updateStatus = updateStatus;
		}
	}
}
